home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / Stonewall.dxr / Internal_11_reserve cards.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  4.8 KB  |  163 lines

  1. property spriteNum, row, motion, location, fp
  2. global tableau, stock, equal, getlist, reserve, waste, godlist, currentsel, dimpos, extras, points, foundation
  3.  
  4. on beginSprite me
  5.   row = determinerow()
  6.   waste.addProp(row, new(script("card pile")))
  7.   location = sprite(spriteNum).loc
  8.   sprite(spriteNum).member = member(stock.cards[1].rank & "_" & stock.cards[1].suit, "playing cards")
  9.   stock.cards.deleteAt(1)
  10.   waste[row].addCard(spriteNum)
  11. end
  12.  
  13. on determinerow
  14.   if spriteNum = 119 then
  15.     return #wone
  16.   else
  17.     if spriteNum = 120 then
  18.       return #wtwo
  19.     else
  20.       if spriteNum = 121 then
  21.         return #wthree
  22.       else
  23.         if spriteNum = 122 then
  24.           return #wfour
  25.         else
  26.           if spriteNum = 123 then
  27.             return #wfive
  28.           else
  29.             if spriteNum = 124 then
  30.               return #wsix
  31.             else
  32.               if spriteNum = 125 then
  33.                 return #wseven
  34.               else
  35.                 if spriteNum = 126 then
  36.                   return #weight
  37.                 else
  38.                   if spriteNum = 127 then
  39.                     return #wnine
  40.                   else
  41.                     if spriteNum = 128 then
  42.                       return #wten
  43.                     else
  44.                       if spriteNum = 129 then
  45.                         return #wele
  46.                       else
  47.                         if spriteNum = 130 then
  48.                           return #wtwel
  49.                         else
  50.                           if spriteNum = 131 then
  51.                             return #wthir
  52.                           else
  53.                             if spriteNum = 132 then
  54.                               return #wfourtee
  55.                             else
  56.                               if spriteNum = 133 then
  57.                                 return #fiftyn
  58.                               else
  59.                                 if spriteNum = 134 then
  60.                                   return #sixtyn
  61.                                 end if
  62.                               end if
  63.                             end if
  64.                           end if
  65.                         end if
  66.                       end if
  67.                     end if
  68.                   end if
  69.                 end if
  70.               end if
  71.             end if
  72.           end if
  73.         end if
  74.       end if
  75.     end if
  76.   end if
  77. end
  78.  
  79. on mouseDown me
  80.   if sprite(spriteNum).member <> member("empty", "playing cards") then
  81.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  82.     sprite(spriteNum).locZ = spriteNum + 1000
  83.     getlist = waste[row]
  84.     motion = timeout(string(spriteNum)).new(5, #moving, me)
  85.   else
  86.     sendSprite(spriteNum - 1, #mouseDown)
  87.   end if
  88. end
  89.  
  90. on moving me
  91.   if the mouseDown then
  92.     sprite(spriteNum).loc = the mouseLoc
  93.   else
  94.     if the mouseUp then
  95.       motion.forget()
  96.       sprite(spriteNum).locZ = spriteNum
  97.       abort()
  98.     end if
  99.   end if
  100. end
  101.  
  102. on mouseUp me
  103.   if equal then
  104.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  105.     sprite(currentsel).member = member(sprite(spriteNum).member.name, "playing cards")
  106.     godlist.addCard(currentsel)
  107.     if spriteNum <> waste[row].getlastcard().spnum then
  108.     end if
  109.     hull()
  110.     waste[row].cards.deleteOne(waste[row].getlastcard())
  111.     waste.deleteProp(row)
  112.     sprite(spriteNum).member = member("empty", "playing cards")
  113.     sprite(spriteNum).loc = location
  114.     getlist = VOID
  115.     godlist = VOID
  116.     equal = 0
  117.     if objectp(foundation[sprite(currentsel).row]) then
  118.       points = points + 10
  119.     end if
  120.     checkwin()
  121.     repeat with u in [26, 42, 58, 74, 90, 106]
  122.       if tableau[sprite(u).row].getcardcount() > 0 then
  123.         sprite(u).loc = sprite(tableau[sprite(u).row].getlastcard().spnum).location
  124.         next repeat
  125.       end if
  126.       sprite(u).loc = sprite(u).location
  127.     end repeat
  128.     currentsel = 0
  129.   else
  130.     if not equal then
  131.       puppetSound(3, member("drop card", "100GPak Generic SFX"))
  132.       sprite(spriteNum).loc = location
  133.       getlist = VOID
  134.     end if
  135.   end if
  136.   repeat with u in [26, 42, 58, 74, 90, 106]
  137.     if tableau[sprite(u).row].getcardcount() > 0 then
  138.       sprite(u).loc = sprite(tableau[sprite(u).row].getlastcard().spnum).location
  139.       next repeat
  140.     end if
  141.     sprite(u).loc = sprite(u).location
  142.   end repeat
  143. end
  144.  
  145. on hull me
  146.   if waste.count > 1 then
  147.     if spriteNum <> waste[waste.count].getlastcard().spnum then
  148.       repeat with shit = 1 to waste.count
  149.         if (shit - 1) = 0 then
  150.           next repeat
  151.         end if
  152.         if sprite(waste[shit].getlastcard().spnum).spriteNum >= spriteNum then
  153.           sprite(waste[shit].getlastcard().spnum).loc = sprite(waste[shit - 1].getlastcard().spnum).location
  154.           updateStage()
  155.         end if
  156.       end repeat
  157.       repeat with shit = 1 to waste.count
  158.         sprite(waste[shit].getlastcard().spnum).location = sprite(waste[shit].getlastcard().spnum).loc
  159.       end repeat
  160.     end if
  161.   end if
  162. end
  163.